﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;

namespace DAL
{
    public class ComplaintType
    {
        public static DataTable getByParentId(int parentid)
        {
            return DbHelper.ExecuteDataTable("[dbo].[P_ComplaintType_getByParent]", parentid);
        }
        public static ComplaintTypeEntity getById(int dId)
        {
            DataRow dr = DbHelper.ExecuteDataRow("[dbo].[p_ComplaintType_getById]", dId);
            ComplaintTypeEntity ctEnt = new ComplaintTypeEntity();
            if (dr != null)
            {
                ctEnt.Ctname = dr["ctName"].ToString();
                ctEnt.DepartmentId = Convert.ToInt32(dr["departmentId"]);
                ctEnt.ParentId = Convert.ToInt32(dr["parentId"]);
                ctEnt.CtNo = dr["ctNo"].ToString();
                ctEnt.sort = Convert.ToInt32(dr["sort"]);
                ctEnt.isShow = Convert.ToBoolean(dr["isShow"]);
                ctEnt.severityLevel = dr["severityLevel"].ToString();
            }
            return ctEnt;
        }
    }
}
